package com.diwu.diwuoj.judge.codesandbox.impl;

import com.diwu.diwuoj.judge.codesandbox.CodeSandbox;
import com.diwu.diwuoj.judge.codesandbox.model.ExecuteCodeRequest;
import com.diwu.diwuoj.judge.codesandbox.model.ExecuteCodeResponse;
import com.diwu.diwuoj.judge.codesandbox.model.JudgeInfo;
import com.diwu.diwuoj.model.enums.JudgeInfoMessageEnum;
import com.diwu.diwuoj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * @Description  示例的代码沙箱
 * @Author diwu
 * @Date 2024/7/1
 */
public class ExampleCodeSandbox implements CodeSandbox {

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试代码成功");
       executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setTime(100L);
        judgeInfo.setMemory(100L);
        executeCodeResponse.setJudgeInfo(judgeInfo);
        return executeCodeResponse;
    }
}
